import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import*
testCase6="DBshop006_删除取消订单流程"
firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,'销售管理','订单管理')#进入订单管理

rootPath=get_pro_rootpath()  #找到路径
ordeId=readFile(rootPath+'\public\order1.txt')  #调用函数 找到orderID

firefox.find_element_by_name("order_sn").send_keys(ordeId)
# firefox.find_element_by_xpath('//button[contains(text(),"搜索")]').click()
firefox.find_element_by_xpath('//button').click()

firefox.find_element_by_id("select_checkbox_state_1").click()
s1=firefox.find_element_by_id("allEdit")
from selenium.webdriver.support.select import  Select
Select(s1).select_by_visible_text('删除')
#处理下拉框

firefox.find_element_by_xpath('//button[contains(text(),"提交操作")]').click()

#处理弹窗
firefox.switch_to.alert.accept()
time.sleep(3)
DBshopSearchOrderID(firefox,ordeId)
time.sleep(4)
string=firefox.find_element_by_xpath('//body').text


Order_cont=reGetString(string,'订单数:','\)')
if Order_cont=='0':
    writeLog('%s 测试成功'%testCase6)
else:
    writeLog('%s 测试失败'%testCase6)

